<template>
  <div>
    <el-form :model="seo" label-width="120px">
      <el-row>
        <el-col :span="24">
          <el-form-item label="商城标题:">
            <el-input v-model="seo.seoMallTitle" placeholder="商城标题" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="商城关键字:">
            <el-input v-model="seo.seoMallKeywords" placeholder="商城关键字" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="商城描述:">
            <el-input v-model="seo.seoMallDesc" type="textarea" :rows="4" show-world-limit maxlength="1000" placeholder="商城描述" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col style="text-align: right;">
          <el-button size="mini" icon="el-icon-check" type="primary" @click="dataFormSubmit()">确定</el-button>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      seo: {
        seoMallTitle: '',
        seoMallDesc: '',
        seoMallKeywords: ''
      }
    }
  },
  activated() {
    this.init()
  },
  methods: {
    init() {
      this.$http({
        url: this.$http.adornUrl('/sysconfig/getSeos'),
        method: 'post',
        data: {}
      }).then(({ data }) => {
        this.seo.seoMallTitle = data.result.seoMallTitle
        this.seo.seoMallDesc = data.result.seoMallDesc
        this.seo.seoMallKeywords = data.result.seoMallKeywords
      })
    },
    dataFormSubmit() {
      this.$http({
        url: this.$http.adornUrl(`/sysconfig/setSeos`),
        method: 'post',
        data: this.$http.adornData(this.config)
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.visible = false
              this.$emit('refreshDataList')
            }
          })
        } else {
          this.$message.error(data.msg)
        }
      })
    }
  }
}
</script>
